package ModelLayer;
/**
 * Class Person is a class representing shared characteristics of the different person types.
 *
 * @author  Danny M.P., Jakob K., Anna K., Anders A.P., Mie P.  
 * @version 1.0
 */
public class Person {

    private String name;
    private String address;
    private String email;
    private String tlf;
    
    /**
     * Constructs an instance of class Person.
     *
     * @param name
     * @param address
     * @param email
     * @param tlf
     */
    public Person(String name, String address, String email, String tlf) {

        super();
        setName(name);
        setAddress(address);
        setEmail(email);
        setTlf(tlf);

    }
    
    public Person() {  
        


    }
    
    /**
     * Returns the value in the name variable.
     *
     * @return  name    Person name.
     */
    public String getName() {

        return name;

    }
    
    /**
     * Set the value of the name. The name should be longer than 5 characters whitout white spaces.
     * 
     * @param name
     */
    public void setName(String name) {

        this.name = name;

    }
    
    /**
     * Returns the value of address.
     *
     * @return The address of a Person object.
     */
    public String getAddress() {

        return address;

    }
    
    /**
     * Sets the value of the variable address.
     *
     * @param address The address of the person.
     */
    public void setAddress(String address) {

        this.address = address;

    }
    
    /**
     * Returns the value of the variable email.
     *
     * @return The e-mail address of the person.
     */
    public String getEmail() {

        return email;

    }
    
    /**
     * Sets the value of the variable email.
     * @param email The e-mail address of the person.
     */
    public void setEmail(String email) {

        this.email = email;

    }
    
    /**
     * Returns the value of the variable tlf.
     *
     * @return The phone number of the person.
     */
    public String getTlf() {
        return tlf;
    }
    
    /**
     * Sets the value of the variable tlf.
     *
     * @param tlf The phone number of the person.
     */
    public void setTlf(String tlf) {

            this.tlf = tlf;

    }
    
    /**
     * Method for compare two Person objects. If both name and e-mail address
     * of the objects are the same, is the two objects declared for being the same.
     * 
     * @return boolean
     */
    @Override
    public boolean equals(Object obj) {

        boolean isEqual = false;
        if (obj == null) {
            isEqual = false;
        }
        if (!(obj instanceof Person)) {
            isEqual = false;
        }
        Person other = (Person) obj;
        if (this.getName().equals(other.getName()) && this.getEmail().equals(other.getEmail())) {
            isEqual = true;
        }
        return isEqual;

    }

}	